//
//  NearbyHospitalShowController.m
//  easyHealthy
//
//  Created by yanchao on 15/11/29.
//  Copyright © 2015年 easyHealthTeam. All rights reserved.
//

#import "NearbyHospitalShowController.h"
#import "hospitalShowView.h"
#import "NearbyHospitalMessageModel.h"

@interface NearbyHospitalShowController ()
{
    //存放信息的数组
    NSMutableArray * MessageArray;
}
@end

@implementation NearbyHospitalShowController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    MessageArray = [[NSMutableArray alloc] init];
    [self reqestHospitalMessage];
   
}
//请求数据
- (void) reqestHospitalMessage {
    AFHTTPRequestOperationManager * manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    [manager GET:API_HOSPITAL_SHOW parameters:@{@"id":_hospitalId} success:^(AFHTTPRequestOperation *operation, id responseObject) {
        id hospitalShowObj = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NearbyHospitalMessageModel * model = [[NearbyHospitalMessageModel alloc] init];
        [model setValuesForKeysWithDictionary:hospitalShowObj];
        [MessageArray addObject:model];
        [self createUI];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
}
//创建界面
- (void)createUI {
    hospitalShowView * backView = [[hospitalShowView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) andHospitalArray:MessageArray];
    [self.view addSubview:backView];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
